home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
kermit.columbia.edu
/
kermit.columbia.edu.tar
/
kermit.columbia.edu
/
newsgroups
/
misc.20000217-20000824
/
000047_news@columbia.edu _Sat Feb 26 11:10:50 2000.msg
< prev
next >
Wrap
Internet Message Format
|
2000-08-23
|
4KB
Return-Path: <news@columbia.edu>
Received: from newsmaster.cc.columbia.edu (newsmaster.cc.columbia.edu [128.59.59.30])
by watsun.cc.columbia.edu (8.8.5/8.8.5) with ESMTP id LAA07331
for <kermit.misc@watsun.cc.columbia.edu>; Sat, 26 Feb 2000 11:10:50 -0500 (EST)
Received: (from news@localhost)
by newsmaster.cc.columbia.edu (8.9.3/8.9.3) id KAA24981
for kermit.misc@watsun.cc.columbia.edu; Sat, 26 Feb 2000 10:41:13 -0500 (EST)
X-Authentication-Warning: newsmaster.cc.columbia.edu: news set sender to <news> using -f
From: fdc@watsun.cc.columbia.edu (Frank da Cruz)
Subject: Re: Array name passed to macro as argument?
Date: 26 Feb 2000 15:41:12 GMT
Organization: Columbia University
Message-ID: <898s6o$ocj$1@newsmaster.cc.columbia.edu>
To: kermit.misc@columbia.edu
In article <897bui$l35$1@nnrp1.deja.com>,
Peter Easthope <peter_easthope@gulfnet.pinc.com> wrote:
: ...
: Thanks Frank. For the programming objective which
: instigated the enquiry I found a nice solution based on
: redefinition of a macro within a macro. With any luck you
: will be able to examine it soon. Your instructions about
: array syntax are recorded for future reference.
:
: Perhaps a brief discussion and comparison of syntax of
: formal languages can be tolerated here. This is for
: interest and is not a criticism of Kermit.
:
: I also program in J ...
:
Although J is new to me, it seems indeed there are many
similarities. Of course these come of the common needs of
programmers in any language.
: Alternatively, the name of the array, rather than the
: value it contains, is passed to fn this way.
: fn 'I'
:
Kermit uses different syntax for scalars and arrays, plus
there are two kinds of scalars:
Name Referenced Result
\%a \%a Evaluated recursively
foo \m(foo) Evaluated one level deep
: I did not realize that MS-DOS Kermit is written in
: assembler. Wow!
: ...
: I have used J6 on a PC with DOS 5.0 and never encountered
: a limit. One J application was much larger than my Kermit
: application. J6 must use extended memory or something
: similar.
:
It must be. Or else it simply uses all of "low memory" for
language purposes, whereas MS-DOS Kermit also has to fit all
its file transfer, terminal emulation, character-set
translation, and communications (including an entire TCP/IP
stack) in the same space, and still leave space to run
external commands.
: 1. Some manipulations of an array, including transfer as
: argument, can be performed without reference to components.
:
In C-Kermit 7.0 and K95 1.1.19, we have a whole new set of
array operations: CLEAR, COPY, DECLARE, DESTROY, RESIZE, SET,
SHOW, SORT. HELP ARRAY gives the details.
However, (at least) one is missing: ARRAY EQUATE. This would
have been just what you needed:
define foo {
array equate a \%1
echo \&a[1]
...
}
This would redirect all references to array \&a[] or its members
to the argument array, which achieves the affect of call by
reference. I'll add this to the list for future releases.
Until then, if you didn't mind making a copy of the array, you
could use:
define foo {
local \&a[]
array copy \%1 a
echo \&a[1]
...
}
But of course then any changes you made to the local array
would not be reflected in the original. This is equivalent
to call by value.
Lots of other array operations are possible, but they are usually
best accomplished using the tools already there. You can see
some examples in the C-Kermit script library:
http://www.columbia.edu/kermit/ckscripts.html#oops
- Frank